/**
 * Created by liguangsong on 16/8/3.
 */
import React from 'react'
import { Link, hashHistory } from 'react-router'
import getTeamColor from '../../assist/teamColor.js'

var TitleView = React.createClass({
    render() {
        var imgSrc = '';
        if (!(this.props.playerId == 0)) {
            imgSrc = 'http://stats.nba.com/media/players/230x185/' + this.props.playerId +'.png'
        }
        var playerNumber = this.props.playerNumber;
        if (playerNumber === '') {
            playerNumber = "未定";
        }

        var teamColor = getTeamColor(this.props.playerTeam);
        return (
            <div className="playerTitleView" style={{ background: this.props.backColor }}>
                <img onClick={this.handleClick} src="app/assist/return.png" style={{width: '30px'}} className="return" />
                <div className="playerIconView">
                    <img className="playerIcon" src={imgSrc} />
                </div>
                <p className="playerInfo">{this.props.playerName}</p>
                <p className="playerInfo" style={{ top: '35px' }}>{playerNumber}</p>

            </div>
        )
    },

    handleClick(event) {
        event.preventDefault();
        hashHistory.push('/');
    }
});

export default TitleView;